package com.zslc.securitymonitoring.controller;

import com.zslc.securitymonitoring.service.AlarmTypeService;
import com.zslc.securitymonitoring.service.VulService;
import com.zslc.securitymonitoring.util.ResultCMS;
import com.zslc.securitymonitoring.vo.GlobalSeverityStatistic;
import com.zslc.securitymonitoring.vo.GlobalSeverityVO;
import com.zslc.securitymonitoring.vo.VulStatisticVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


/**
 * 安全漏洞
 *
 * @author Gyc
 */
@Slf4j
@RestController
@RequestMapping("/vul")
public class VulController {
    @Autowired
    private VulService vulService;

    /**
     * 过去六个月安全漏洞分布统计
     *
     * @return com.zslc.securitymonitoring.util.ResultCMS
     * @author Gaoyc
     * @date 2024/06/12 14:59
     */
    @GetMapping("/type/statistic")
    public ResultCMS vulStatistic() {
        try {
            List<VulStatisticVO> resultMap = vulService.vulStatisticBy6Month();
            return ResultCMS.success(resultMap);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return ResultCMS.fail_5000();
        }
    }
}
